#!/usr/bin/env python3.8
# -*- encoding: utf-8 -*-
'''
@File    :   email.py
@Time    :   2021/10/11 20:10:05
@Author  :   windstarry 
@Version :   1.0
'''
# here put the import lib

from flask import render_template, current_app
from app.utils import send_email


def send_confirm_email(user):
    token = user.generate_confirmation_token()
    send_email('[MyBBS] Confirm Your Username',
               sender=current_app.config['MAIL_USERNAME'],
               recipients=[user.email],
               text_body=render_template('auth/email/confirm.txt',
                                         user=user, token=token),
               html_body=render_template('auth/email/confirm.html',
                                         user=user, token=token))